#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>

using namespace std;

int minimumSum(int n, int k) {
    if (n <= k / 2)
        return getsum(1, 1, n);
    else
        return getsum(1, 1, k / 2) + getsum(k, 1, n - k / 2);
}

int getsum(int a1, int d, int n)
{
    return (a1 + a1 + (n - 1) * d) * n / 2;
}